import 'package:dk_flutter_base/dk_ui.dart';

typedef TapActionCallBack = void Function(int index);

class  TwoButtonWidget extends StatelessWidget {
  //点击事件
  final TapActionCallBack tapAction;
  final String leftTitle;
  final String rightTitle;

   TwoButtonWidget({this.tapAction,this.leftTitle = "",this.rightTitle = ""});
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 60,
      padding: EdgeInsets.only(left: 16, right: 16, top: 5,bottom: 5),
      decoration: new BoxDecoration(
        color: Colors.white,
        boxShadow: [
          BoxShadow(
              color: Color.fromRGBO(0, 0, 0, 0.16),
              offset: Offset(0, -1.0),
              blurRadius: 3.0,
              spreadRadius: 0.0)
        ],
      ),
      child: Row(
        children: <Widget>[
          Expanded(
            child: DkClick(
              child: Container(
                margin: EdgeInsets.only(top: 5,bottom: 5),
                decoration: BoxDecoration(
                    borderRadius:BorderRadius.circular(3) ,
                    border: Border.all(width: 0.5,color: Color(0xFF3DBCC6))
                ),
                child: Center(
                  child: Text(
                    this.leftTitle,
                    style: TextStyle(
                      color: Color(0xFF3DBCC6),
                      fontSize: 16,
                    ),
                  ),
                ),
              ),
              onTap: () {
                this.tapAction(0);
              },
            ),
          ),
          SizedBox(width: 13,height: 0,),
          Expanded(
            child: DkClick(
              child: Container(
                margin: EdgeInsets.only(top: 5,bottom: 5),
                decoration: BoxDecoration(
                    borderRadius:BorderRadius.circular(3) ,
                  color: Color(0xFF3DBCC6),
                ),
                child: Center(
                  child: Text(
                    this.rightTitle,
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 16,
                    ),
                  ),
                ),
              ),
              onTap: () {
                this.tapAction(1);
              },
            ),
          ),
        ],
      ),
    );
  }
}